package com.ldk.springboot2021.serviceImpl;

import com.ldk.springboot2021.mapper.OrderMapper;
import com.ldk.springboot2021.pojo.Order;
import com.ldk.springboot2021.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

//业务层实现类
@Service
public class OrderServiceImpl implements OrderService {
    //在业务层中注入持久层对象
    @Autowired(required = false)//括号里内容解决下一行报错
    private OrderMapper orderMapper;



    @Override
    public int addOrder(Order order) {
        int row = orderMapper.save(order);
        return row;
    }

    @Override
    public List<Order> lookAllOrder() {
        return orderMapper.lookAllOrder();
    }

    @Override
    public Order lookOrderById(int num) {
        return orderMapper.lookOrderById(num);
    }

    @Override
    public int updateAll(Order order) {
        int row=orderMapper.updateAll(order);
        return row;
    }

    @Override
    public int deletById(int num) {
        return orderMapper.deleteFromId(num);
    }
}
